home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWSemEvt / Sources / FWDscOpr.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.9 KB  |  155 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWDscOpr.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWDSCOPR_H
  11. #include "FWDscOpr.h"
  12. #endif
  13.  
  14. #ifndef FWDESC_H
  15. #include "FWDesc.h"
  16. #endif
  17.  
  18. #ifndef FWSCPTBL_H
  19. #include "FWScptbl.h"
  20. #endif
  21.  
  22. //========================================================================================
  23. //    Runtime Information
  24. //========================================================================================
  25.  
  26. #ifdef FW_BUILD_MAC    
  27. #pragma segment fwsemevt2
  28. #endif
  29.  
  30. //---------------------------------------------------------------------------------------
  31. //    operator FW_CDesc& << FW_CDesc&
  32. //---------------------------------------------------------------------------------------
  33.  
  34. FW_CDesc& operator<< (FW_CDesc& desc, const FW_CDesc& other)
  35. {
  36.     desc.PutDataByDesc(other);
  37.     return desc;
  38. }
  39.  
  40. //---------------------------------------------------------------------------------------
  41. //    operator FW_CDesc& >> FW_CDesc&
  42. //---------------------------------------------------------------------------------------
  43.  
  44. const FW_CDesc& operator>> (const FW_CDesc& desc, FW_CDesc& other)
  45. {
  46.     other = desc;
  47.     return desc;
  48. }
  49.  
  50. //---------------------------------------------------------------------------------------
  51. //    operator FW_CDesc& << ODDescType&
  52. //---------------------------------------------------------------------------------------
  53.  
  54. FW_CDesc& operator<< (FW_CDesc& desc, ODDescType typeValue)
  55. {
  56.     desc.PutDataByPtr(typeType, &typeValue, sizeof(ODDescType));
  57.     return desc;
  58. }
  59.  
  60. //---------------------------------------------------------------------------------------
  61. //    operator FW_CDesc& >> ODDescType&
  62. //---------------------------------------------------------------------------------------
  63.  
  64. const FW_CDesc& operator>> (const FW_CDesc& desc, ODDescType& typeValue)
  65. {
  66.     Size     actualSize;
  67.             
  68.     desc.GetDataByPtr(typeType, &typeValue, actualSize, sizeof(ODDescType));
  69.     return desc;
  70. }
  71.  
  72. //---------------------------------------------------------------------------------------
  73. //    operator FW_CDesc& << long&
  74. //---------------------------------------------------------------------------------------
  75.  
  76. FW_CDesc& operator<< (FW_CDesc& desc, long value)
  77. {
  78.     desc.PutDataByPtr(typeLongInteger, &value, sizeof(long));
  79.     return desc;
  80. }
  81.  
  82. //---------------------------------------------------------------------------------------
  83. //    operator FW_CDesc& >> long&
  84. //---------------------------------------------------------------------------------------
  85.  
  86. const FW_CDesc& operator>> (const FW_CDesc& desc, long& value)
  87. {
  88.     Size    actualSize;
  89.             
  90.     desc.GetDataByPtr(typeLongInteger, &value, actualSize, sizeof(long));
  91.     return desc;
  92. }
  93.  
  94. //---------------------------------------------------------------------------------------
  95. //    operator FW_CDesc& << FW_CColor&
  96. //---------------------------------------------------------------------------------------
  97.  
  98. FW_CDesc& operator<< (FW_CDesc& desc, const FW_CColor& color)
  99. {
  100.     desc.PutColor(color);
  101.     return desc;
  102. }
  103.  
  104. //---------------------------------------------------------------------------------------
  105. //    operator FW_CDesc& >> FW_CColor&
  106. //---------------------------------------------------------------------------------------
  107.  
  108. const FW_CDesc& operator>> (const FW_CDesc& desc, FW_CColor& color)
  109. {
  110.      desc.GetColor(color);
  111.      return desc;
  112. }
  113.  
  114. //---------------------------------------------------------------------------------------
  115. //    operator FW_CDesc& << FW_SPlatformPoint&
  116. //---------------------------------------------------------------------------------------
  117.  
  118. FW_CDesc& operator<< (FW_CDesc& desc, const FW_SPlatformPoint& thePoint)
  119. {
  120.     desc.PutPoint(thePoint);
  121.     return desc;
  122. }
  123.  
  124. //---------------------------------------------------------------------------------------
  125. //    operator FW_CDesc& >> FW_SPlatformPoint&
  126. //---------------------------------------------------------------------------------------
  127.  
  128. const FW_CDesc& operator>> (const FW_CDesc& desc, FW_SPlatformPoint& thePoint)
  129. {
  130.      thePoint = desc.GetPoint();
  131.      return desc;
  132. }
  133.  
  134. //----------------------------------------------------------------------------------------
  135. //    FW_InsertScriptableIntoDesc
  136. //----------------------------------------------------------------------------------------
  137.  
  138. void FW_InsertScriptableIntoDesc(const FW_MScriptable* scriptable, FW_CDesc& desc)
  139. {
  140.     desc.PutDataByPtr(scriptable->GetTokenType(), &scriptable, sizeof(scriptable));
  141. }
  142.  
  143. //----------------------------------------------------------------------------------------
  144. //    FW_ExtractScriptableFromDesc
  145. //----------------------------------------------------------------------------------------
  146.  
  147. FW_MScriptable* FW_ExtractScriptableFromDesc(const FW_CDesc& desc)
  148. {
  149.     Size             actualSize;
  150.     FW_MScriptable* scriptable;
  151.     
  152.     desc.GetDataByPtr(typeODFSemanticObject, &scriptable, actualSize, sizeof(scriptable));
  153.     return scriptable;
  154. }
  155.